package cn.wsalix.observable.service.impl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.wsalix.msg.service.MessRapportService;
import cn.wsalix.observable.service.ReadMessService;
import cn.wsalix.user.form.MessRapportForm;
import cn.wsalix.user.service.MineService;

@Service("readMessService")
public class ReadMessBuildService {
	protected Logger logger = LoggerFactory.getLogger(getClass());
	@Autowired
	private MessRapportService messRapportService;

	@Autowired
	private MineService myProductService;
	private List<ReadMessService> list = new ArrayList<ReadMessService>();

	@PostConstruct
	public void init() {
		logger.info("==========init");
		list.add(myProductService);
		list.add(messRapportService);
	}

	@PreDestroy
	public void destroy() {
		logger.info("==========destroy");
	}

	@Transactional
	public void readMess(MessRapportForm form) {
		for (ReadMessService readMessService:list) {
			readMessService.sendMess(form);
		}
	}

}
